#!/bin/bash
dev=`ip r | grep -w 'metric 1' | cut -d ' ' -f 3`
if [ -z $dev ];then
dev=`ip r | grep -w 'metric 2' | cut -d ' ' -f 3`
fi
echo $dev
